#!/usr/bin/env python
# coding: utf-8


from apscheduler.schedulers.blocking import BlockingScheduler
import sys
from config import config
from os.path import join
from etl_funds_service.fund_information_one import *
from etl_funds_service.fund_information_two import *
from etl_funds_service.fund_performance import *
from etl_funds_service.fund_assets_one import *
from etl_funds_service.fund_assets_two import *
from etl_funds_service.fund_holders import *
from etl_funds_service.bonds_information import *
from etl_funds_service.fund_cwk import *
from etl_funds_service.fund_derivative import *
import logging

scheduler = BlockingScheduler()


@scheduler.scheduled_job(id='etl_checksum', trigger='cron', day_of_week='0-6', hour='1,13', minute=20)
def work():
    """

    :return:
    """

    FundSecurities.work()
    InstitutionsCompany.work()
    PeopleBasicInfo.work()
    FundPlateInfo.work()


try:
    scheduler.start()
except (KeyboardInterrupt, SystemExit):
        scheduler.shutdown()
        logging.info('Export bonds_info_service data finished.')
